package com.xiaxueqi.web.portal;

import org.springframework.beans.factory.annotation.Autowired;

import com.niagara.dao.Page;
import com.niagara.service.base.BaseService;
import com.niagara.web.struts2.BaseStruts2Action;

/**
 * 通过条件筛选来完成的相关搜索
 * @author liangThink
 */
public class SelectAction extends BaseStruts2Action {
	private static final long serialVersionUID = 1L;

	@Autowired
	private BaseService baseService;

	// 搜索的范围：BookStore,AppUser,AppOrder,分别是数列表、店铺列表、求购列表
	private String scope;

	@SuppressWarnings("unchecked")
	private Page page;// page里面的数据类型是通过scope所提供的类型来确定的

	@Override
	public String execute() {
		this.page = BasePortalAction.getPageScope(baseService, scope,
				DEFAULT_PAGE_SIZE);
		return "success";
	}

	@SuppressWarnings("unchecked")
	public Page getPage() {
		return page;
	}

	@SuppressWarnings("unchecked")
	public void setPage(Page page) {
		this.page = page;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}
}
